package com.nodity.gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

public class VisualNode extends Rectangle implements Selectable{
	
	
	public boolean selected;
	private Object data;
	
	public VisualNode(int x, int y, char c) {
			
		
		setBounds(x,y,30,30);
		data=c;
	}


	public void renderNode(Graphics g){
		g.setColor(Color.BLACK);
		g.fillOval(x, y, width, height);
		g.setColor(Color.WHITE);
		g.drawString(String.valueOf(data),x+10,y+10);
		
		if(selected){
			
			g.setColor(Color.GREEN);
			g.drawOval(x, y, width, height);
		
		}
	}
	
	public boolean isSelected(Point p){
		if(contains(p)){
			return true;
		}
		return false;
	}
	
	public void setSelected(Point p){
		if(isSelected(p)){
			selected=true;
		}else
			selected=false;
	


	}


	
}